<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>MyClouds：测试页</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
		<style type="text/css">

		</style>

	</head>
	<body>
		<ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu">

		</ul>

		<script id="tpl" type="text/html">
			<%# layui.each(d.data, function(index, item){ %>
				<%#  
				  var fnHref = function(){
					if(item.url){
						return 'lay-href="' + item.url + '"';
					}else{
						return '';
					}
				  }; 
				%>
				<li data-name="id-<% item.id %>" class="<% item.cls %>">
					<a href="javascript:;" <% fnHref() %> lay-direction="2">
						<i class="<% item.icon %>"></i>
						<cite><% item.label %></cite>
					</a>
					<%# layui.each(item.children, function(index, item){ %>
						<%#  if(index === 0){ %>
						<dl class="layui-nav-child">
						<%#  } %>
							  <dd>
								<a lay-href="<% item.label %>"><% item.label %></a>
							  </dd>
						<%# if(index === parent.length - 1){ %>
						</dl>
						<%#  } %>
					<%# }); %>
				</li>	
			<%# }); %>
		</script>

	</body>
	<script src="../../layuiadmin/layui/layui.js"></script>
	<script type="text/javascript">
		layui.config({
			base: '../../layuiadmin/' //静态资源所在路径
		}).extend({
			index: 'lib/index' //主入口模块
		}).use(['index', 'myutil', 'laytpl'], function() {
			var $ = layui.$,
				laytpl = layui.laytpl,
				myutil = layui.myutil;
			//
			laytpl.config({
				open: '<%',
				close: '%>'
			});
			var data = {
				data: [{
					id: 0,
					label: '欢迎页',
					icon: 'layui-icon layui-icon-home',
					cls: 'layui-nav-item',
					url: 'views/home/welcome.html'
			}, {
					id: 1,
					label: '系统管理',
					icon: 'layui-icon layui-icon-component',
					cls: 'layui-nav-item layui-nav-itemed',
					children: [{
						id: 11,
						label: '数据字典',
						url: 'views/home/dic1.html'
				}, {
						id: 12,
						label: '资源模块',
						url: 'views/home/dic2.html'
				}]
			}, {
					id: 2,
					label: '虚拟业务',
					icon: 'layui-icon layui-icon-app',
					cls: 'layui-nav-item',
					children: [{
						id: 21,
						label: '业务菜单1',
						url: 'views/home/dic3.html'
				}]
			}]
			};
			laytpl($('#tpl').html()).render(data, function(html) {
				$('#LAY-system-side-menu').html(html);
				layui.element.render('nav');
			});
		});
	</script>

</html>
